#!/bin/bash
PERF="/usr/bin/time -v"
NICE=
curpath=`pwd`
# 各库的地址
extso=.so
localdevdir="${curpath}/git3rd/mimalloc-bench/extern"
my_lib="${curpath}/build_lib"
readonly lib_rp="`find ${localdevdir}/rp/bin/*/release -name librpmallocwrap$extso 2> /dev/null`"
readonly lib_tbb="$localdevdir/tbb/bench_release/libtbbmalloc_proxy$extso"
readonly lib_tbb_dir=`dirname $lib_tbb`

readonly lddir="LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${lib_tbb_dir}"

liblist="sys
hd
tc
je
lp
tbb
rp
mesh
mi
sn
wfspan
wfspan_wfqp
tlsf
tlsf_sffwd
hslab
wfslab"

compiler_prefix="cl"

ldlibpaths="libxxx.so
$localdevdir/hd/src/libhoard$extso
$localdevdir/tc/.libs/libtcmalloc_minimal$extso
$localdevdir/je/lib/libjemalloc$extso
$localdevdir/lp/Source/bmalloc/libpas/build-cmake-default/Release/libpas_lib$extso
${lib_tbb} 
$lib_rp
$localdevdir/mesh/build/lib/libmesh$extso
$localdevdir/mi/out/release/libmimalloc$extso
$localdevdir/sn/release/libsnmallocshim$extso
${my_lib}/${compiler_prefix}libwfspanmalloc$extso
${my_lib}/${compiler_prefix}libwfspan_wfqpmalloc$extso
${my_lib}/${compiler_prefix}libtlsfmalloc$extso
${my_lib}/${compiler_prefix}libtlsf_sffwdmalloc$extso
${my_lib}/${compiler_prefix}libhslabmalloc$extso
${my_lib}/${compiler_prefix}libwfslabmalloc$extso"

liblist_wcmf="sys
hd
tc
je
lp
tbb
rp
mesh
mi
sn
wfspan
wfspan_wfqp
wfspan_2
wfspan_4
tlsf
tlsf_sffwd
hslab
wfslab"

ldlibpaths_wcmf="libxxx.so
$localdevdir/hd/src/libhoard$extso
$localdevdir/tc/.libs/libtcmalloc_minimal$extso
$localdevdir/je/lib/libjemalloc$extso
$localdevdir/lp/Source/bmalloc/libpas/build-cmake-default/Release/libpas_lib$extso
${lib_tbb}
$lib_rp
$localdevdir/mesh/build/lib/libmesh$extso
$localdevdir/mi/out/release/libmimalloc$extso
$localdevdir/sn/release/libsnmallocshim$extso
${my_lib}/${compiler_prefix}libwfspanmalloc$extso
${my_lib}/${compiler_prefix}libwfspan_wfqpmalloc$extso
${my_lib}/${compiler_prefix}libwfspan_2malloc$extso
${my_lib}/${compiler_prefix}libwfspan_4malloc$extso
${my_lib}/${compiler_prefix}libtlsfmalloc$extso
${my_lib}/${compiler_prefix}libtlsf_sffwdmalloc$extso
${my_lib}/${compiler_prefix}libhslabmalloc$extso
${my_lib}/${compiler_prefix}libwfslabmalloc$extso"

libsize_list="sys
hd
tc
je
lp
tbb
rp
mesh
mi
sn
wfspan
wfspan_wfqp
tlsf
tlsf_sffwd
hslab
wfslab
wfslabfl
dh
hm
iso
mng
scudo
mi-sec
sn-sec
wfslab_s
hslab_d
tlsf_sffwd_sd"

glibc_loc=`gcc --print-file-name=libc.a`

libsize="${glibc_loc}
$localdevdir/hd/src/libhoard$extso
$localdevdir/tc/.libs/libtcmalloc_minimal$extso.4.5.10
$localdevdir/je/lib/libjemalloc$extso.2
$localdevdir/lp/Source/bmalloc/libpas/build-cmake-default/Release/libpas_lib$extso
$lib_tbb_dir/libtbbmalloc.so.2.9
$lib_rp
$localdevdir/mesh/build/lib/libmesh$extso
$localdevdir/mi/out/release/libmimalloc$extso.1.7
$localdevdir/sn/release/libsnmallocshim$extso
${my_lib}/${compiler_prefix}libwfspanmalloc$extso
${my_lib}/${compiler_prefix}libwfspan_wfqpmalloc$extso
${my_lib}/${compiler_prefix}libtlsfmalloc$extso
${my_lib}/${compiler_prefix}libtlsf_sffwdmalloc$extso
${my_lib}/${compiler_prefix}libhslabmalloc$extso
${my_lib}/${compiler_prefix}libwfslabmalloc$extso
${my_lib}/${compiler_prefix}libwfslabflmalloc$extso
$localdevdir/dh/src/libdieharder$extso
$localdevdir/hm/out/libhardened_malloc$extso
$localdevdir/iso/build/libisoalloc$extso
$localdevdir/mng/libmallocng$extso
$localdevdir/scudo/compiler-rt/lib/scudo/standalone/libscudo$extso
$localdevdir/mi/out/secure/libmimalloc-secure$extso.1.7
$localdevdir/sn/release/libsnmallocshim-checks$extso
${my_lib}/${compiler_prefix}libwfslab_smalloc$extso
${my_lib}/${compiler_prefix}libhslab_dmalloc$extso
${my_lib}/${compiler_prefix}libtlsf_sffwd_sdmalloc$extso"